<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>晒羊毛-撸羊毛有风险，投资需谨慎</title>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/bootstrap.min.css"></head>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/style.min.css"></head>
	<link rel="stylesheet" type="text/css" href="<%=path%>/js/plugins/datapicker/datepicker3.css"></head>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"></head>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/sym.css"></head>
	<script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script type="text/javascript" src="<%=path%>/js/layer/layer.js"></script>
	<script type="text/javascript" src="<%=path%>/js/common.js"></script>
	<script type="text/javascript" src="<%=path %>/js/plugins/ajaxfileupload.js"></script>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>
<div class="layout ">
	<div class="mb20">
		<div class="hbox">
			<div class="hd">
				<h3>修改banner配置</h3>
			</div>
			<div class="bd clearfix">
				<form id="banner_image_form" class="form-horizontal m-t" action="javascript:uploadImage('banner_image_img','banner_file','banner_image',2)">
					<div class="form-group">
						<div class="pull-left col-sm-12 row-sm-2">
							<img src="<%=path %>/uncheck/pictures/servlet?id=${banner.bannerPicture}" id="banner_image_img"  width="100%" height="100%">
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-11" style="text-align: center">
							<input type="file" name="file" id="banner_file" style="width: 200px"/>
							<button class="btn btn-primary" id="upload_btn">上传</button>
						</div>
					</div>
				</form>
				<form id="banner_update_form" class="form-horizontal m-t" action="javascript:updateBannerConfig()">
					<input type="hidden" id="banner_image" name="bannerPicture" value="${banner.bannerPicture}">
					<input type="hidden" id="banner_id" name="bannerId" value="${banner.bannerId}">
					<div class="form-group">
						<label class="col-sm-3 control-label">banner名称：</label>
						<div class="col-sm-5">
							<input type="text" class="form-control"  name="bannerName" value="${banner.bannerName}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">banner序号：</label>
						<div class="col-sm-5">
							<input type="text" class="form-control" placeholder="序号大的显示在前面" name="bannerNo" value="${banner.bannerNo}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">banner链接地址：</label>
						<div class="col-sm-5">
							<input type="text" class="form-control" placeholder="可为空" name="bannerUrl" value="${banner.bannerUrl}" >
						</div>
					</div>
					<div class="form-group" id="data_banner_start_time">
						<label class="col-sm-3 control-label">上线时间:</label>
						<div class="col-sm-5">
							<div id="datepicker" class="input-daterange input-group">
								<input type="text"  name="startTime"  value="<fmt:formatDate value='${banner.startTime}' pattern='yyyy-MM-dd HH:mm:ss' />" class="input-sm form-control">
							</div>
						</div>
					</div>
					<div class="form-group" id="data_banner_end_time">
						<label class="col-sm-3 control-label">下线时间：</label>
						<div class="col-sm-5">
							<div id="datepicker" class="input-daterange input-group">
								<input type="text"  name="endTime"  value="<fmt:formatDate value='${banner.endTime}' pattern='yyyy-MM-dd HH:mm:ss' />" class="input-sm form-control">
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-8 col-sm-offset-3">
							<button type="submit" class="btn btn-primary" id="banner_update_btn">确定</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<jsp:include page="/views/commons/footer.jsp"></jsp:include>

<script type="text/javascript">
	$(function() {
		$("#data_banner_start_time .input-daterange").datepicker({
			keyboardNavigation: !1,
			forceParse: !1,
			autoclose: !0
		});
		$("#data_banner_end_time .input-daterange").datepicker({
			keyboardNavigation: !1,
			forceParse: !1,
			autoclose: !0
		});
	})
	
	function updateBannerConfig(){
		$("#banner_update_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/admin/banner/update",
			type : "post",
			dataType : "json",
			data : $("#banner_update_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg("发布成功",{icon: 1});
					window.location.href=path + "/views/index.jsp";
				}else{
					layer.msg(data.message,{icon: 2});
					$("#banner_update_btn").removeClass("disabled").removeAttr("disabled").val("提交");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#banner_update_btn").removeClass("disabled").removeAttr("disabled").val("提交");
			}
		});
	}
	</script>
</body>
</html>